/*
   Copyright 2009 Bloo. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
package org.youtensils.www.client.events;

import com.google.gwt.user.client.ui.Widget;

/**
 * A download event listener interface defining methods to handle download events.
 * @author Bobby Soares
 */
public interface DownloadListener {
	
	/**
	 * Signals that the progress for a given download has changed.
	 * @param sender the widget that sent this event
	 * @param id the download id
	 * @param totalSteps the total number of steps required to successful download completion
	 * @param currentStep the current step
	 * @param totalBytes the total byte size of the item being downloaded
	 * @param loadedBytes the amount of bytes that have loaded for the item being downloaded
	 * @param label a label describing the current step
	 */
	public void onDownloadProgress(Widget sender, String id, int totalSteps, int currentStep, int totalBytes, int loadedBytes, String label);
	
	/**
	 * Signals that a download has started.
	 * @param sender the widget that sent this event
	 * @param id the download id
	 */
	public void onBeginDownload(Widget sender, String id);
	
	/**
	 * Signals that a download has completed.
	 * @param sender the widget that sent this event
	 * @param id the download id
	 */
	public void onCompleteDownload(Widget sender, String id);
	
	/**
	 * Signals that a download has been canceled.
	 * @param sender the widget that sent this event
	 * @param id the download id
	 */
	public void onCancelDownload(Widget sender, String id);
	
	/**
	 * Signals that a download error has occurred.
	 * @param sender the widget that sent this event
	 * @param id the download id
	 * @param error the download error description
	 */
	public void onErrorDownload(Widget sender, String id, String error);
	
	/**
	 * Signals that the Java Applet component is running inside a sandbox.
	 */
	public void onSandboxDetected(Widget sender);
}
